//
//  BaseItemViewController.m
//  Dayou
//
//  Created by mac on 2018/8/13.
//  Copyright © 2018年 YangYang. All rights reserved.
//

#import "BaseItemViewController.h"

#import "BaseTableViewController.h"

#import <SDCycleScrollView.h>
#import "FirstViewController.h"
#import "SecondViewController.h"
#import "ThirdViewController.h"

@interface BaseItemViewController ()<YNPageViewControllerDataSource,YNPageViewControllerDelegate,SDCycleScrollViewDelegate>
@property (nonatomic, copy) NSArray *imagesURLs;

@property (nonatomic, strong) UITableView *tableView;


@end

@implementation BaseItemViewController

- (void)viewDidLoad {
    [super viewDidLoad];


}

+ (instancetype)suspendTopPageVC
{
    YNPageConfigration *configration = [YNPageConfigration defaultConfig];
    configration.pageStyle = YNPageStyleSuspensionTop;
    configration.headerViewCouldScale = NO;
    configration.showTabbar = NO;
    configration.showNavigation = YES;
    configration.scrollMenu = YES;
    configration.aligmentModeCenter = YES;
    configration.lineWidthEqualFontWidth = YES;
    configration.showBottomLine = YES;

    BaseItemViewController *baseItemVC = [BaseItemViewController pageViewControllerWithControllers:[self getVCs] titles:[self getTitles] config:configration];
    baseItemVC.dataSource = baseItemVC;
    baseItemVC.delegate = baseItemVC;


    SDCycleScrollView *cycleSV = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, ScreenWidth, 300) delegate:self placeholderImage:nil];
    cycleSV.imageURLStringsGroup = baseItemVC.imagesURLs;
    baseItemVC.headerView = cycleSV;

    return baseItemVC;
}

+(NSArray *)getVCs
{
    FirstViewController *firstVC = [[FirstViewController alloc] init];
    SecondViewController *secondVC = [[SecondViewController alloc] init];
    ThirdViewController *thirdVC = [[ThirdViewController alloc] init];
    return @[firstVC,secondVC,thirdVC];
}

+(NSArray *)getTitles
{
    return @[@"鞋子",@"衣服",@"帽子"];
}

- (NSArray *)imagesURLs {
    if (!_imagesURLs) {
        _imagesURLs = @[
                        @"https://ss2.baidu.com/-vo3dSag_xI4khGko9WTAnF6hhy/super/whfpf%3D425%2C260%2C50/sign=a4b3d7085dee3d6d2293d48b252b5910/0e2442a7d933c89524cd5cd4d51373f0830200ea.jpg",
                        @"https://ss0.baidu.com/-Po3dSag_xI4khGko9WTAnF6hhy/super/whfpf%3D425%2C260%2C50/sign=a41eb338dd33c895a62bcb3bb72e47c2/5fdf8db1cb134954a2192ccb524e9258d1094a1e.jpg",
                        @"http://c.hiphotos.baidu.com/image/w%3D400/sign=c2318ff84334970a4773112fa5c8d1c0/b7fd5266d0160924c1fae5ccd60735fae7cd340d.jpg"];
    }
    return _imagesURLs;
}

- (__kindof UIScrollView *)pageViewController:(YNPageViewController *)pageViewController
                                  pageForIndex:(NSInteger )index
{
    BaseTableViewController *vc = pageViewController.controllersM[index];
    return vc.tableView;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
